Imports BusinessLayer
Imports EntityLayer

Partial Class ListaCartaPresentacion
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Call MostrarCartas()
        End If
    End Sub

    Private Sub MostrarCartas()
        gvwCartaPresentacion.DataSource = CartaPresentacionBL.ListarCartasPresentacion
        gvwCartaPresentacion.DataBind()
    End Sub

    Protected Sub gvwCartaPresentacion_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles gvwCartaPresentacion.RowDeleting
        Dim strIdCarta As String
        strIdCarta = gvwCartaPresentacion.DataKeys(e.RowIndex).Value
        If CartaPresentacionBL.Eliminar(strIdCarta) = True Then
            Call MostrarCartas()
        End If
    End Sub

    Protected Sub gvwCartaPresentacion_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvwCartaPresentacion.SelectedIndexChanged
        Dim strIdCarta As String

        strIdCarta = gvwCartaPresentacion.DataKeys(gvwCartaPresentacion.SelectedIndex).Value

        Response.Redirect("CartaPresentacion.aspx?NC=" & strIdCarta)
    End Sub
End Class
